{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from pandas import Series, DataFrame\n",
    "\n",
    "filename = '../data/cities.json'\n",
    "df = pd.read_json(filename)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Beyond 1\n",
    "\n",
    "Convert the `growth_from_2000_to_2013` column into a floating-point number. Then find the mean and median changes in city size between 2000 and 2013."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "mean    22.936\n",
       "50%      9.650\n",
       "Name: growth_from_2000_to_2013, dtype: float64"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Remove trailing %\n",
    "df['growth_from_2000_to_2013'] = df['growth_from_2000_to_2013'].str.rstrip('%')\n",
    "\n",
    "# Find empty strings, and turn to 0\n",
    "df.loc[df['growth_from_2000_to_2013'] == '', 'growth_from_2000_to_2013'] = '0'\n",
    "\n",
    "# Turn to float, return mean + median\n",
    "df['growth_from_2000_to_2013'].astype(float).describe()[['mean', '50%']]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Beyond 2\n",
    "\n",
    "How many cities had positive growth in this period, and how many had negative growth?\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "growth_from_2000_to_2013\n",
       "+    852\n",
       "-    148\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.cut(df['growth_from_2000_to_2013'],\n",
    "        bins=[df['growth_from_2000_to_2013'].min(), 0, df['growth_from_2000_to_2013'].max()],\n",
    "        include_lowest=True,\n",
    "        labels=['-', '+']).value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Beyond 3\n",
    "\n",
    "Find the cities that whose latitude is more than two standard deviations away from the mean."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>city</th>\n",
       "      <th>growth_from_2000_to_2013</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "      <th>population</th>\n",
       "      <th>rank</th>\n",
       "      <th>state</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>Miami</td>\n",
       "      <td>14.9</td>\n",
       "      <td>25.761680</td>\n",
       "      <td>-80.191790</td>\n",
       "      <td>417650</td>\n",
       "      <td>44</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>Honolulu</td>\n",
       "      <td>-6.2</td>\n",
       "      <td>21.306944</td>\n",
       "      <td>-157.858333</td>\n",
       "      <td>347884</td>\n",
       "      <td>54</td>\n",
       "      <td>Hawaii</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>62</th>\n",
       "      <td>Anchorage</td>\n",
       "      <td>15.4</td>\n",
       "      <td>61.218056</td>\n",
       "      <td>-149.900278</td>\n",
       "      <td>300950</td>\n",
       "      <td>63</td>\n",
       "      <td>Alaska</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>Hialeah</td>\n",
       "      <td>3.2</td>\n",
       "      <td>25.857596</td>\n",
       "      <td>-80.278106</td>\n",
       "      <td>233394</td>\n",
       "      <td>89</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130</th>\n",
       "      <td>Brownsville</td>\n",
       "      <td>26.8</td>\n",
       "      <td>25.901747</td>\n",
       "      <td>-97.497484</td>\n",
       "      <td>181860</td>\n",
       "      <td>131</td>\n",
       "      <td>Texas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>138</th>\n",
       "      <td>Fort Lauderdale</td>\n",
       "      <td>0.7</td>\n",
       "      <td>26.122439</td>\n",
       "      <td>-80.137317</td>\n",
       "      <td>172389</td>\n",
       "      <td>139</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145</th>\n",
       "      <td>Cape Coral</td>\n",
       "      <td>60.4</td>\n",
       "      <td>26.562854</td>\n",
       "      <td>-81.949533</td>\n",
       "      <td>165831</td>\n",
       "      <td>146</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149</th>\n",
       "      <td>Pembroke Pines</td>\n",
       "      <td>17.4</td>\n",
       "      <td>26.007765</td>\n",
       "      <td>-80.296256</td>\n",
       "      <td>162329</td>\n",
       "      <td>150</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>173</th>\n",
       "      <td>Hollywood</td>\n",
       "      <td>4.8</td>\n",
       "      <td>26.011201</td>\n",
       "      <td>-80.149490</td>\n",
       "      <td>146526</td>\n",
       "      <td>174</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>187</th>\n",
       "      <td>McAllen</td>\n",
       "      <td>27.6</td>\n",
       "      <td>26.203407</td>\n",
       "      <td>-98.230012</td>\n",
       "      <td>136639</td>\n",
       "      <td>188</td>\n",
       "      <td>Texas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>Miramar</td>\n",
       "      <td>74.7</td>\n",
       "      <td>25.986076</td>\n",
       "      <td>-80.303560</td>\n",
       "      <td>130288</td>\n",
       "      <td>196</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>207</th>\n",
       "      <td>Coral Springs</td>\n",
       "      <td>5.7</td>\n",
       "      <td>26.271192</td>\n",
       "      <td>-80.270604</td>\n",
       "      <td>126604</td>\n",
       "      <td>208</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>242</th>\n",
       "      <td>Miami Gardens</td>\n",
       "      <td>10.5</td>\n",
       "      <td>25.942038</td>\n",
       "      <td>-80.245604</td>\n",
       "      <td>111378</td>\n",
       "      <td>243</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>268</th>\n",
       "      <td>Everett</td>\n",
       "      <td>9.4</td>\n",
       "      <td>47.978985</td>\n",
       "      <td>-122.202079</td>\n",
       "      <td>105370</td>\n",
       "      <td>269</td>\n",
       "      <td>Washington</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>275</th>\n",
       "      <td>Pompano Beach</td>\n",
       "      <td>4.0</td>\n",
       "      <td>26.237860</td>\n",
       "      <td>-80.124767</td>\n",
       "      <td>104410</td>\n",
       "      <td>276</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>279</th>\n",
       "      <td>West Palm Beach</td>\n",
       "      <td>23.5</td>\n",
       "      <td>26.715342</td>\n",
       "      <td>-80.053375</td>\n",
       "      <td>102436</td>\n",
       "      <td>280</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>306</th>\n",
       "      <td>Davie</td>\n",
       "      <td>17.7</td>\n",
       "      <td>26.076478</td>\n",
       "      <td>-80.252116</td>\n",
       "      <td>96830</td>\n",
       "      <td>307</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>335</th>\n",
       "      <td>Miami Beach</td>\n",
       "      <td>3.3</td>\n",
       "      <td>25.790654</td>\n",
       "      <td>-80.130045</td>\n",
       "      <td>91026</td>\n",
       "      <td>336</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>339</th>\n",
       "      <td>Plantation</td>\n",
       "      <td>8.6</td>\n",
       "      <td>26.127586</td>\n",
       "      <td>-80.233104</td>\n",
       "      <td>90268</td>\n",
       "      <td>340</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>341</th>\n",
       "      <td>Sunrise</td>\n",
       "      <td>4.6</td>\n",
       "      <td>26.166971</td>\n",
       "      <td>-80.256595</td>\n",
       "      <td>90116</td>\n",
       "      <td>342</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>344</th>\n",
       "      <td>Boca Raton</td>\n",
       "      <td>7.5</td>\n",
       "      <td>26.368306</td>\n",
       "      <td>-80.128932</td>\n",
       "      <td>89407</td>\n",
       "      <td>345</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>389</th>\n",
       "      <td>Bellingham</td>\n",
       "      <td>21.8</td>\n",
       "      <td>48.749080</td>\n",
       "      <td>-122.478147</td>\n",
       "      <td>82631</td>\n",
       "      <td>390</td>\n",
       "      <td>Washington</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>400</th>\n",
       "      <td>Mission</td>\n",
       "      <td>74.5</td>\n",
       "      <td>26.215907</td>\n",
       "      <td>-98.325293</td>\n",
       "      <td>81050</td>\n",
       "      <td>401</td>\n",
       "      <td>Texas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>403</th>\n",
       "      <td>Edinburg</td>\n",
       "      <td>65.1</td>\n",
       "      <td>26.301737</td>\n",
       "      <td>-98.163343</td>\n",
       "      <td>80836</td>\n",
       "      <td>404</td>\n",
       "      <td>Texas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>421</th>\n",
       "      <td>Deerfield Beach</td>\n",
       "      <td>4.8</td>\n",
       "      <td>26.318412</td>\n",
       "      <td>-80.099766</td>\n",
       "      <td>78041</td>\n",
       "      <td>422</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>454</th>\n",
       "      <td>Pharr</td>\n",
       "      <td>55.7</td>\n",
       "      <td>26.194796</td>\n",
       "      <td>-98.183622</td>\n",
       "      <td>73790</td>\n",
       "      <td>455</td>\n",
       "      <td>Texas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>473</th>\n",
       "      <td>Boynton Beach</td>\n",
       "      <td>17.3</td>\n",
       "      <td>26.531787</td>\n",
       "      <td>-80.090547</td>\n",
       "      <td>71097</td>\n",
       "      <td>474</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>487</th>\n",
       "      <td>Lauderhill</td>\n",
       "      <td>4.2</td>\n",
       "      <td>26.140363</td>\n",
       "      <td>-80.213381</td>\n",
       "      <td>69813</td>\n",
       "      <td>488</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>496</th>\n",
       "      <td>Weston</td>\n",
       "      <td>34.5</td>\n",
       "      <td>26.100365</td>\n",
       "      <td>-80.399775</td>\n",
       "      <td>68388</td>\n",
       "      <td>497</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>500</th>\n",
       "      <td>Fort Myers</td>\n",
       "      <td>31.2</td>\n",
       "      <td>26.640628</td>\n",
       "      <td>-81.872308</td>\n",
       "      <td>68190</td>\n",
       "      <td>501</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>526</th>\n",
       "      <td>Harlingen</td>\n",
       "      <td>11.6</td>\n",
       "      <td>26.190631</td>\n",
       "      <td>-97.696103</td>\n",
       "      <td>65665</td>\n",
       "      <td>527</td>\n",
       "      <td>Texas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>541</th>\n",
       "      <td>Homestead</td>\n",
       "      <td>100.7</td>\n",
       "      <td>25.468722</td>\n",
       "      <td>-80.477557</td>\n",
       "      <td>64079</td>\n",
       "      <td>542</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>543</th>\n",
       "      <td>Delray Beach</td>\n",
       "      <td>6.1</td>\n",
       "      <td>26.461462</td>\n",
       "      <td>-80.072820</td>\n",
       "      <td>64072</td>\n",
       "      <td>543</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>551</th>\n",
       "      <td>Marysville</td>\n",
       "      <td>115.7</td>\n",
       "      <td>48.051764</td>\n",
       "      <td>-122.177082</td>\n",
       "      <td>63269</td>\n",
       "      <td>552</td>\n",
       "      <td>Washington</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>552</th>\n",
       "      <td>Tamarac</td>\n",
       "      <td>12.9</td>\n",
       "      <td>26.212861</td>\n",
       "      <td>-80.249771</td>\n",
       "      <td>63155</td>\n",
       "      <td>553</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>579</th>\n",
       "      <td>North Miami</td>\n",
       "      <td>2.0</td>\n",
       "      <td>25.890095</td>\n",
       "      <td>-80.186714</td>\n",
       "      <td>61007</td>\n",
       "      <td>580</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>587</th>\n",
       "      <td>Wellington</td>\n",
       "      <td>55.0</td>\n",
       "      <td>26.661763</td>\n",
       "      <td>-80.268357</td>\n",
       "      <td>60202</td>\n",
       "      <td>588</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>635</th>\n",
       "      <td>Coconut Creek</td>\n",
       "      <td>28.4</td>\n",
       "      <td>26.251748</td>\n",
       "      <td>-80.178935</td>\n",
       "      <td>56792</td>\n",
       "      <td>636</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>655</th>\n",
       "      <td>Margate</td>\n",
       "      <td>2.7</td>\n",
       "      <td>26.244526</td>\n",
       "      <td>-80.206436</td>\n",
       "      <td>55456</td>\n",
       "      <td>656</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>664</th>\n",
       "      <td>Grand Forks</td>\n",
       "      <td>11.5</td>\n",
       "      <td>47.925257</td>\n",
       "      <td>-97.032855</td>\n",
       "      <td>54932</td>\n",
       "      <td>665</td>\n",
       "      <td>North Dakota</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>737</th>\n",
       "      <td>Doral</td>\n",
       "      <td>137.6</td>\n",
       "      <td>25.819542</td>\n",
       "      <td>-80.355330</td>\n",
       "      <td>50213</td>\n",
       "      <td>738</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>751</th>\n",
       "      <td>Coral Gables</td>\n",
       "      <td>16.1</td>\n",
       "      <td>25.721490</td>\n",
       "      <td>-80.268384</td>\n",
       "      <td>49631</td>\n",
       "      <td>752</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>786</th>\n",
       "      <td>Bonita Springs</td>\n",
       "      <td>43.8</td>\n",
       "      <td>26.339806</td>\n",
       "      <td>-81.778697</td>\n",
       "      <td>47547</td>\n",
       "      <td>787</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>802</th>\n",
       "      <td>Minot</td>\n",
       "      <td>26.6</td>\n",
       "      <td>48.232967</td>\n",
       "      <td>-101.292291</td>\n",
       "      <td>46321</td>\n",
       "      <td>803</td>\n",
       "      <td>North Dakota</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>847</th>\n",
       "      <td>Cutler Bay</td>\n",
       "      <td>42.9</td>\n",
       "      <td>25.580832</td>\n",
       "      <td>-80.346859</td>\n",
       "      <td>43328</td>\n",
       "      <td>848</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>848</th>\n",
       "      <td>Oakland Park</td>\n",
       "      <td>2.7</td>\n",
       "      <td>26.172307</td>\n",
       "      <td>-80.131989</td>\n",
       "      <td>43286</td>\n",
       "      <td>849</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>849</th>\n",
       "      <td>North Miami Beach</td>\n",
       "      <td>3.6</td>\n",
       "      <td>25.933149</td>\n",
       "      <td>-80.162546</td>\n",
       "      <td>43250</td>\n",
       "      <td>850</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>863</th>\n",
       "      <td>North Lauderdale</td>\n",
       "      <td>10.8</td>\n",
       "      <td>26.217305</td>\n",
       "      <td>-80.225881</td>\n",
       "      <td>42757</td>\n",
       "      <td>864</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>954</th>\n",
       "      <td>Greenacres</td>\n",
       "      <td>35.5</td>\n",
       "      <td>26.627628</td>\n",
       "      <td>-80.135390</td>\n",
       "      <td>38696</td>\n",
       "      <td>955</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>956</th>\n",
       "      <td>Hallandale Beach</td>\n",
       "      <td>12.4</td>\n",
       "      <td>25.981202</td>\n",
       "      <td>-80.148379</td>\n",
       "      <td>38632</td>\n",
       "      <td>957</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>990</th>\n",
       "      <td>Aventura</td>\n",
       "      <td>47.2</td>\n",
       "      <td>25.956481</td>\n",
       "      <td>-80.139212</td>\n",
       "      <td>37199</td>\n",
       "      <td>991</td>\n",
       "      <td>Florida</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>Weslaco</td>\n",
       "      <td>28.8</td>\n",
       "      <td>26.159519</td>\n",
       "      <td>-97.990837</td>\n",
       "      <td>37093</td>\n",
       "      <td>996</td>\n",
       "      <td>Texas</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  city growth_from_2000_to_2013   latitude   longitude  \\\n",
       "43               Miami                     14.9  25.761680  -80.191790   \n",
       "53            Honolulu                     -6.2  21.306944 -157.858333   \n",
       "62           Anchorage                     15.4  61.218056 -149.900278   \n",
       "88             Hialeah                      3.2  25.857596  -80.278106   \n",
       "130        Brownsville                     26.8  25.901747  -97.497484   \n",
       "138    Fort Lauderdale                      0.7  26.122439  -80.137317   \n",
       "145         Cape Coral                     60.4  26.562854  -81.949533   \n",
       "149     Pembroke Pines                     17.4  26.007765  -80.296256   \n",
       "173          Hollywood                      4.8  26.011201  -80.149490   \n",
       "187            McAllen                     27.6  26.203407  -98.230012   \n",
       "195            Miramar                     74.7  25.986076  -80.303560   \n",
       "207      Coral Springs                      5.7  26.271192  -80.270604   \n",
       "242      Miami Gardens                     10.5  25.942038  -80.245604   \n",
       "268            Everett                      9.4  47.978985 -122.202079   \n",
       "275      Pompano Beach                      4.0  26.237860  -80.124767   \n",
       "279    West Palm Beach                     23.5  26.715342  -80.053375   \n",
       "306              Davie                     17.7  26.076478  -80.252116   \n",
       "335        Miami Beach                      3.3  25.790654  -80.130045   \n",
       "339         Plantation                      8.6  26.127586  -80.233104   \n",
       "341            Sunrise                      4.6  26.166971  -80.256595   \n",
       "344         Boca Raton                      7.5  26.368306  -80.128932   \n",
       "389         Bellingham                     21.8  48.749080 -122.478147   \n",
       "400            Mission                     74.5  26.215907  -98.325293   \n",
       "403           Edinburg                     65.1  26.301737  -98.163343   \n",
       "421    Deerfield Beach                      4.8  26.318412  -80.099766   \n",
       "454              Pharr                     55.7  26.194796  -98.183622   \n",
       "473      Boynton Beach                     17.3  26.531787  -80.090547   \n",
       "487         Lauderhill                      4.2  26.140363  -80.213381   \n",
       "496             Weston                     34.5  26.100365  -80.399775   \n",
       "500         Fort Myers                     31.2  26.640628  -81.872308   \n",
       "526          Harlingen                     11.6  26.190631  -97.696103   \n",
       "541          Homestead                    100.7  25.468722  -80.477557   \n",
       "543       Delray Beach                      6.1  26.461462  -80.072820   \n",
       "551         Marysville                    115.7  48.051764 -122.177082   \n",
       "552            Tamarac                     12.9  26.212861  -80.249771   \n",
       "579        North Miami                      2.0  25.890095  -80.186714   \n",
       "587         Wellington                     55.0  26.661763  -80.268357   \n",
       "635      Coconut Creek                     28.4  26.251748  -80.178935   \n",
       "655            Margate                      2.7  26.244526  -80.206436   \n",
       "664        Grand Forks                     11.5  47.925257  -97.032855   \n",
       "737              Doral                    137.6  25.819542  -80.355330   \n",
       "751       Coral Gables                     16.1  25.721490  -80.268384   \n",
       "786     Bonita Springs                     43.8  26.339806  -81.778697   \n",
       "802              Minot                     26.6  48.232967 -101.292291   \n",
       "847         Cutler Bay                     42.9  25.580832  -80.346859   \n",
       "848       Oakland Park                      2.7  26.172307  -80.131989   \n",
       "849  North Miami Beach                      3.6  25.933149  -80.162546   \n",
       "863   North Lauderdale                     10.8  26.217305  -80.225881   \n",
       "954         Greenacres                     35.5  26.627628  -80.135390   \n",
       "956   Hallandale Beach                     12.4  25.981202  -80.148379   \n",
       "990           Aventura                     47.2  25.956481  -80.139212   \n",
       "995            Weslaco                     28.8  26.159519  -97.990837   \n",
       "\n",
       "     population  rank         state  \n",
       "43       417650    44       Florida  \n",
       "53       347884    54        Hawaii  \n",
       "62       300950    63        Alaska  \n",
       "88       233394    89       Florida  \n",
       "130      181860   131         Texas  \n",
       "138      172389   139       Florida  \n",
       "145      165831   146       Florida  \n",
       "149      162329   150       Florida  \n",
       "173      146526   174       Florida  \n",
       "187      136639   188         Texas  \n",
       "195      130288   196       Florida  \n",
       "207      126604   208       Florida  \n",
       "242      111378   243       Florida  \n",
       "268      105370   269    Washington  \n",
       "275      104410   276       Florida  \n",
       "279      102436   280       Florida  \n",
       "306       96830   307       Florida  \n",
       "335       91026   336       Florida  \n",
       "339       90268   340       Florida  \n",
       "341       90116   342       Florida  \n",
       "344       89407   345       Florida  \n",
       "389       82631   390    Washington  \n",
       "400       81050   401         Texas  \n",
       "403       80836   404         Texas  \n",
       "421       78041   422       Florida  \n",
       "454       73790   455         Texas  \n",
       "473       71097   474       Florida  \n",
       "487       69813   488       Florida  \n",
       "496       68388   497       Florida  \n",
       "500       68190   501       Florida  \n",
       "526       65665   527         Texas  \n",
       "541       64079   542       Florida  \n",
       "543       64072   543       Florida  \n",
       "551       63269   552    Washington  \n",
       "552       63155   553       Florida  \n",
       "579       61007   580       Florida  \n",
       "587       60202   588       Florida  \n",
       "635       56792   636       Florida  \n",
       "655       55456   656       Florida  \n",
       "664       54932   665  North Dakota  \n",
       "737       50213   738       Florida  \n",
       "751       49631   752       Florida  \n",
       "786       47547   787       Florida  \n",
       "802       46321   803  North Dakota  \n",
       "847       43328   848       Florida  \n",
       "848       43286   849       Florida  \n",
       "849       43250   850       Florida  \n",
       "863       42757   864       Florida  \n",
       "954       38696   955       Florida  \n",
       "956       38632   957       Florida  \n",
       "990       37199   991       Florida  \n",
       "995       37093   996         Texas  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[(df['latitude'] > df['latitude'].mean() + 2*df['latitude'].std()) |\n",
    "   (df['latitude'] < df['latitude'].mean() - 2*df['latitude'].std()) ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
